package com.zim.aliot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.zim.aliot.client.LcxClient;
import com.zim.aliot.lcx.LcxResult;

@RestController
@RequestMapping("/test")
public class TestController {
	
	@Autowired
	private LcxClient lcxClient;

	@RequestMapping(value = "/event", method = { RequestMethod.POST,
	            RequestMethod.GET }, produces = "application/json;charset=UTF-8")
	public LcxResult event() {

		LcxResult result = lcxClient.sendEvent("LNBSCB3F2JW174276", "IGNITE", "0", 1550729810, 1550729810);
		
		return result;
	}
	
	@RequestMapping(value = "/warning", method = { RequestMethod.POST,
            RequestMethod.GET }, produces = "application/json;charset=UTF-8")
	public LcxResult warning() {
		LcxResult result = lcxClient.sendWarning("LNBSCB3F2JW1123", "OBD", "insert", 1550731889, 1550731889);
		
		return result;
		
	}
	
	@RequestMapping(value = "/blueTooth", method = { RequestMethod.POST,
            RequestMethod.GET }, produces = "application/json;charset=UTF-8")
	public LcxResult blueTooth() {
		LcxResult result = lcxClient.acceptBlueTooth(true, "LNBSCB3F0HW123456", "QT6K", 1527426419);
		
		return result;
		
	}
	
	@RequestMapping(value = "/photo", method = { RequestMethod.POST,
            RequestMethod.GET }, produces = "application/json;charset=UTF-8")
	public LcxResult photo() {
		LcxResult result = lcxClient.sendPhotoEvent("M-TP-1489543957402-LNBSCB3F1FD124830", "ascdscdsvdsxs", "120.616634", "31.337882", 14761755);
		
		return result;
		
	}
	
	@RequestMapping(value = "/instruct", method = { RequestMethod.POST,
            RequestMethod.GET }, produces = "application/json;charset=UTF-8")
	public LcxResult instruct() {
		LcxResult result = lcxClient.acceptInform("M-TP-1489543957402-LNBSCB3F1FD124830", true, 1476175391, "{sacfasc}");
		
		return result;
		
	}
}
